#include <stdio.h>
#include "classes/person.h"
#include "classes/student.h"
#include "classes/worker.h"
#include "classes/engineer.h"

void Classes_Init();

int main() {
    Classes_Init();

    ObjectPtr p1 = Person_New("Hevake", 27);
    ObjectPtr p2 = Person_New("John", 23);
    ObjectPtr s3 = Student_New("Mimi", 13);
    ObjectPtr w1 = Worker_New("Lao", 30);
    Worker_SetJob(w1, "Software developer", 4000);
    Student_SetGrade(s3, 4);
    ObjectPtr e1 = Engineer_New("Zhange", 35);

    ObjectPtr array[] = {p1, p2, s3, w1, e1};

    puts("=Say=====================");
    for (int i = 0; i < 5; i++)
        Person_Say(array[i], "#");

    puts("=Work====================");
    for (int j = 0; j < 10; j++) {
        printf("year[%d]\n", j);
        for (int i = 0; i < 5; i++) //! 每个人都执行一次
            Person_WorkForYear(array[i]);
    }
    puts("=Done====================");

    Person_Delete(p1);
    Person_Delete(p2);
    Student_Delete(s3);
    Worker_Delete(w1);
    Engineer_Delete(e1);

    return 0;
}
